package com.cjm.one.controller.goods;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cjm.one.common.result.Result;
import com.cjm.one.model.goods.vo.GoodsSkuBrowseHistoryVo;
import com.cjm.one.model.goods.vo.GoodsSkuVo;
import com.cjm.one.service.GoodsBrowseHistoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@Tag(name = "商品浏览历史", description = "商品浏览历史")
@RequestMapping("/api/goods/browse/history")
public class GoodsBrowseHistoryController {
    @Resource
    private GoodsBrowseHistoryService goodsBrowseHistoryService;
    @GetMapping("/add")
    @Operation(summary = "添加商品浏览历史")
    public Result<Boolean> add(@RequestParam("skuId") Long skuId){
        log.info("添加商品浏览历史");
      return   goodsBrowseHistoryService.add(skuId) ;
    }
    @DeleteMapping("/deleteBatch")
    @Operation(summary = "删除商品浏览历史")
    public Result<Boolean> deleteBatch(@RequestParam("ids") Long[] ids){
        return  goodsBrowseHistoryService.deleteBatch(ids);

    }
    @GetMapping("/list")
    @Operation(summary = "查询商品浏览历史")
    Result<Page<GoodsSkuVo>> list(@RequestParam("current") Integer current,
                                  @RequestParam("size") Integer size){
        return goodsBrowseHistoryService.list(current,size);
    }
}
